#delimit ;
set more off;

/*NOTE: For a Mac, file path names use a forward slash (/) but for 
PC's they require a backward slash (\). Make these changes below 
if necessary depending on your computer type. Also, install the estout 
command if you haven't already done so:
ssc install estout
*/

*Dropbox paths by user;
if c(username)=="shayaksarkar" {;
	local path "/Users/shayaksarkar/Desktop/ReStat_Data_Publication";
};


/*TABLE 3*/;

cd `path';

use "`path'/dta/final_competition.dta", clear;

	local se cluster(date_auditor);
	local rhs biasterm needterm bnterm;
	local controls govt_und agent_home auditor_home auditor_office other_venue;
	
	reg anyterm `rhs', `se';
	estadd ysumm;
	eststo;

	areg anyterm `rhs' `controls', absorb(ms_id) `se';
	estadd ysumm;
	eststo;

	reg onlyterm `rhs', `se';
	estadd ysumm;
	eststo;

	areg onlyterm `rhs' `controls', absorb(ms_id) `se';
	estadd ysumm;
	eststo;

	reg ln_trc `rhs', `se';
	estadd ysumm;
	eststo;

	areg ln_trc `rhs' `controls', absorb(ms_id) `se';
	estadd ysumm;
	eststo;

	reg ln_tpr `rhs', `se';
	estadd ysumm;
	eststo;

	areg ln_tpr `rhs' `controls', absorb(ms_id) `se';
	estadd ysumm;
	eststo;
	
* Output to Excel file;
esttab est1 est2 est3 est4 est5 est6 est7 est8 using "`path'/out/table3.csv", replace 
cells("b(fmt(5)) _star" se(fmt(5) )) starlevels(* .1 ** .05 *** .01)  
stats (ymean N, fmt( 5 %12.0fc) label("Dep. Var. Mean" N )) plain;
eststo clear;
	

	
